import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import { plainToClass } from 'class-transformer';
import { UserEntity } from '../entity/user.entity';
import { ClassToPlain } from '../helper';

export const ReqUser = createParamDecorator(async (_data:any,ctx:ExecutionContext)=>{
    const request=ctx.switchToHttp().getRequest()
    return request.user as ClassToPlain<UserEntity>;
});